<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    my name is hello world
    <form id="login">
        <input type="text" name="username" autocomplete="off">
        <input type="password" name="password" autocomplete="off"/>
        <input type="submit"/>
    </form>
    <script>
        document.querySelector("#login").addEventListener("submit",function(e){
            e.preventDefault();
            var formData = new FormData(this);
            var oReq = new XMLHttpRequest();
            
            oReq.onload = function(e) {
                console.log(e);
                console.log(this);
            }
            oReq.open("post", "/login");
            oReq.responseType = "json";
            /* oReq.setRequestHeader('Content-Type', 'application/json');
            oReq.send(JSON.stringify({username:"admin",password:"123456"})); */
            oReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
            oReq.send("username=admin&password=123456");
        })
        var oReq = new XMLHttpRequest();
            
        oReq.onload = function(e) {
            console.log(e);
            console.log(this);
        }
        oReq.open("post", "/queryMenuByUserId");
        oReq.responseType = "json";
        oReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
        oReq.send("id=2");
    </script>
    <!-- <form id="form">
        <input name="username" autocomplete/>
        <input type="password" name="password" autocomplete/>
        <input type="file" name="image" />
        <input type="file" name="image2" />
        <input type="submit" />
    </form>
    <script>
        document.querySelector("#form").addEventListener("submit",function(e){
            e.preventDefault();
            var formData = new FormData(this);
            var oReq = new XMLHttpRequest();
            
            oReq.onload = function(e) {
                console.log(e);
            }
            oReq.open("post", "/upload");
            //oReq.setRequestHeader('Content-Type', 'multipart/form-data');
            oReq.send(formData);
        })
    </script> -->
</body>
</html>